# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=gst-plugins-ugly
pkgver=1.24.3
pkgrel=0
pkgdesc="GStreamer streaming media framework ugly plug-ins"
url="https://gstreamer.freedesktop.org"
arch="all"
license="GPL-2.0-or-later LGPL-2.0-or-later"
replaces="gst-plugins-ugly1"
makedepends="
	a52dec-dev
	glib-dev
	gst-plugins-base-dev
	gstreamer-dev
	libcdio-dev
	libdvdread-dev
	libmpeg2-dev
	meson
	orc-dev
	x264-dev
	"
source="
https://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-$pkgver.tar.xz
x264_tests.patch
"

subpackages="$pkgname-lang"
ldpath="/usr/lib/gstreamer-1.0"

# secfixes:
#   1.22.5-r0:
#     - CVE-2023-38104
#     - CVE-2023-38103
#   1.10.4-r0:
#     - CVE-2017-5846
#     - CVE-2017-5847

build() {
	CFLAGS="$CFLAGS -O2" \
	CXXFLAGS="$CXXFLAGS -O2" \
	CPPFLAGS="$CPPFLAGS -O2" \
	abuild-meson \
		-Db_lto=true \
		-Dpackage-origin="https://alpinelinux.org" \
		-Dpackage-name="GStreamer ugly plug-ins (Alpine Linux)" \
		-Dgpl=enabled \
		-Dcdio=disabled \
		-Ddvdread=disabled \
		-Dmpeg2dec=disabled \
		. output
	meson compile -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

check() {
	meson test -C output --print-errorlogs
}

doc() {
	default_doc
	replaces="${pkgname}1-doc"
}

sha512sums="
1964549fdb46210c2f8a918d0fd597d302e431c8585efd7824ab2fddd7c75dc0eed288436c8bc1afcdebb89610c5859fd5901495defb3a2cb6cf823a5d08cbff  gst-plugins-ugly-1.24.3.tar.xz
730a88a20534f77d10ed1543f6e7fcc8825e75c4bba007de02017fc89569f9e5dfd3d383d3479448f687825bb27b19335c0957c360846e5e3e33735b7a7d3bf6  x264_tests.patch
"
